package com.dragee.modules.sys.controller;

import com.dragee.common.PageUtils;
import com.dragee.common.R;
import com.dragee.modules.sys.dao.SysUserRoleMapper;
import com.dragee.modules.sys.entity.UserEntity;
import com.dragee.modules.sys.service.ISysRoleService;
import com.dragee.modules.sys.service.UserRoleService;
import com.dragee.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author tys on 2023/4/13
 */
@RestController
@RequestMapping("work/caiPan")
@Api(tags = "Modules - 裁判库查询")
public class CaiPanController {
    @Autowired
    private UserService userService;
    @Resource
    private SysUserRoleMapper sysUserRoleMapper;
    @Autowired
    private ISysRoleService sysRoleService;
    @Autowired
    private UserRoleService userRoleService;
    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 列表
     */
    @GetMapping("list")
    @ApiOperation("裁判列表")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userService.queryPage(params, "caipan");
        return R.ok().put("data", page);
    }

    /**
     * 信息
     */
    @GetMapping("{userid}")
    @ApiOperation("裁判信息")
    public R info(@PathVariable("userid") Long userid){
        UserEntity user = userService.getById(userid);
        return R.ok().put("data", user);
    }

}
